.class Lcom/nemustech/regina/widgets/tasks/TasksWidget$TaskGadgetRunnable;
.super Ljava/lang/Object;
.source "TasksWidget.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/nemustech/regina/widgets/tasks/TasksWidget;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "TaskGadgetRunnable"
.end annotation


# instance fields
.field mTaskId:I

.field final synthetic this$0:Lcom/nemustech/regina/widgets/tasks/TasksWidget;


# direct methods
.method public constructor <init>(Lcom/nemustech/regina/widgets/tasks/TasksWidget;I)V
    .locals 0
    .parameter
    .parameter "id"

    .prologue
    .line 447
    iput-object p1, p0, Lcom/nemustech/regina/widgets/tasks/TasksWidget$TaskGadgetRunnable;->this$0:Lcom/nemustech/regina/widgets/tasks/TasksWidget;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 448
    iput p2, p0, Lcom/nemustech/regina/widgets/tasks/TasksWidget$TaskGadgetRunnable;->mTaskId:I

    .line 449
    return-void
.end method


# virtual methods
.method public run()V
    .locals 10

    .prologue
    .line 453
    const/4 v8, 0x0

    .line 455
    .local v8, taskCursor:Landroid/database/Cursor;
    :try_start_0
    iget-object v0, p0, Lcom/nemustech/regina/widgets/tasks/TasksWidget$TaskGadgetRunnable;->this$0:Lcom/nemustech/regina/widgets/tasks/TasksWidget;

    invoke-static {v0}, Lcom/nemustech/regina/widgets/tasks/TasksWidget;->access$300(Lcom/nemustech/regina/widgets/tasks/TasksWidget;)Landroid/content/Context;

    move-result-object v0

    check-cast v0, Landroid/app/Activity;

    invoke-static {}, Lcom/nemustech/regina/widgets/tasks/TasksWidget;->access$100()Landroid/net/Uri;

    move-result-object v1

    invoke-static {}, Lcom/nemustech/regina/widgets/tasks/TasksWidget;->access$200()[Ljava/lang/String;

    move-result-object v2

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "_id="

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget v4, p0, Lcom/nemustech/regina/widgets/tasks/TasksWidget$TaskGadgetRunnable;->mTaskId:I

    invoke-static {v4}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    const/4 v4, 0x0

    const/4 v5, 0x0

    invoke-virtual/range {v0 .. v5}, Landroid/app/Activity;->managedQuery(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v8

    .line 457
    if-eqz v8, :cond_0

    .line 458
    invoke-interface {v8}, Landroid/database/Cursor;->moveToFirst()Z

    .line 459
    const-string v0, "end_yn"

    invoke-interface {v8, v0}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v0

    invoke-interface {v8, v0}, Landroid/database/Cursor;->getInt(I)I

    move-result v7

    .line 460
    .local v7, endYn:I
    new-instance v9, Landroid/content/ContentValues;

    invoke-direct {v9}, Landroid/content/ContentValues;-><init>()V

    .line 461
    .local v9, values:Landroid/content/ContentValues;
    if-nez v7, :cond_2

    .line 462
    const-string v0, "end_yn"

    const/4 v1, 0x1

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v9, v0, v1}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 466
    :goto_0
    iget-object v0, p0, Lcom/nemustech/regina/widgets/tasks/TasksWidget$TaskGadgetRunnable;->this$0:Lcom/nemustech/regina/widgets/tasks/TasksWidget;

    invoke-static {v0}, Lcom/nemustech/regina/widgets/tasks/TasksWidget;->access$400(Lcom/nemustech/regina/widgets/tasks/TasksWidget;)Landroid/content/Context;

    move-result-object v0

    check-cast v0, Landroid/app/Activity;

    invoke-virtual {v0}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    invoke-static {}, Lcom/nemustech/regina/widgets/tasks/TasksWidget;->access$100()Landroid/net/Uri;

    move-result-object v1

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "_ID="

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget v3, p0, Lcom/nemustech/regina/widgets/tasks/TasksWidget$TaskGadgetRunnable;->mTaskId:I

    invoke-static {v3}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    const/4 v3, 0x0

    invoke-virtual {v0, v1, v9, v2, v3}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    .line 468
    iget-object v0, p0, Lcom/nemustech/regina/widgets/tasks/TasksWidget$TaskGadgetRunnable;->this$0:Lcom/nemustech/regina/widgets/tasks/TasksWidget;

    invoke-virtual {v0}, Lcom/nemustech/regina/widgets/tasks/TasksWidget;->update()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 473
    .end local v7           #endYn:I
    .end local v9           #values:Landroid/content/ContentValues;
    :cond_0
    if-eqz v8, :cond_1

    invoke-interface {v8}, Landroid/database/Cursor;->close()V

    .line 475
    :cond_1
    :goto_1
    return-void

    .line 464
    .restart local v7       #endYn:I
    .restart local v9       #values:Landroid/content/ContentValues;
    :cond_2
    :try_start_1
    const-string v0, "end_yn"

    const/4 v1, 0x0

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v9, v0, v1}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    .line 470
    .end local v7           #endYn:I
    .end local v9           #values:Landroid/content/ContentValues;
    :catch_0
    move-exception v0

    move-object v6, v0

    .line 471
    .local v6, e:Ljava/lang/Exception;
    :try_start_2
    invoke-virtual {v6}, Ljava/lang/Exception;->printStackTrace()V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 473
    if-eqz v8, :cond_1

    invoke-interface {v8}, Landroid/database/Cursor;->close()V

    goto :goto_1

    .end local v6           #e:Ljava/lang/Exception;
    :catchall_0
    move-exception v0

    if-eqz v8, :cond_3

    invoke-interface {v8}, Landroid/database/Cursor;->close()V

    :cond_3
    throw v0
.end method
